{extend name='common/content' /}

{block name="button"}
<div class="nowrap pull-right" style="margin-top:10px">
    <button data-open='{:url("client/article/add")}' data-title="添加文章" class='layui-btn layui-btn-small'><i
            class='fa fa-plus'></i> 添加文章
    </button>
    <button data-update data-field='delete' data-action='{:url("$classuri/del")}'
            class='layui-btn layui-btn-small layui-btn-danger'><i class='fa fa-remove'></i> 删除文章
    </button>
</div>
{/block}

{block name="content"}

<!-- 表单搜索 开始 -->
<form class="animated form-search" action="__SELF__" onsubmit="return false" method="get">

    <div class="row">
        <div class="col-xs-3">
            <div class="layui-form">
                <input type="text" name="name" value="{$Think.get.name|default=''}" placeholder="文章标题" class="input-sm form-control">
            </div>
        </div>

        <div class="col-xs-1">
            <div class="form-group">
                <!--<button type="submit" class="btn btn-sm btn-white"><i class="fa fa-search"></i> 搜索</button>-->
                <button type="submit" class="btn btn-sm btn-white"><i class="fa fa-search"></i> 搜索</button>
            </div>
        </div>
    </div>
</form>
<!-- 表单搜索 结束 -->

<form onsubmit="return false;" data-auto="" method="POST">
    <input type="hidden" value="resort" name="action"/>
    <div class="layui-form">
        <table class="table table-hover">
            <thead>
            <tr>
                <th>
                    <input data-none-auto="" data-check-target='.list-check-box' lay-skin="primary" lay-filter="allChoose" type="checkbox">
                </th>
                <th class='text-center'>文章标题</th>
                <th class='text-center'>封面图片</th>
                <th class='text-center'>创建时间</th>
                <th class='text-center'>分类</th>
                <!--<th class="text-center">所属庄园名</th>-->
                <th class='text-center'>状态</th>
                <th class='text-center'>操作</th>
            </tr>
            </thead>
            <tbody>

            {foreach $list as $key=>$vo}
            <tr>
                <td>
                    <input class="list-check-box" value='{$vo.id}' lay-skin="primary" type="checkbox">
                </td>
                <td class='text-center'>{$vo.title}</td>
                <td class='text-center'><img style="width: 150px;height: 100px;" src="{$vo.image_id}"></td>
                <td class='text-center'>{$vo.create_time}</td>
                <td class='text-center'>{$vo.category_name}</td>
                <!--<td class="text-center">{$vo.company}</td>-->
                <td class='text-center'>
                    {if $vo.is_check eq 1}
                    <span>待审核</span>
                    {else/}
                    <span style="color:#090">审核</span>
                    {/if}
                </td>
                <td class='text-center nowrap'>


                    <div class="layui-btn-group">
                        <!--{if $vo.is_check eq 1 and b_auth("$classuri/forbid")}
                        <button type="button" data-update="{$vo.id}" data-field='is_check' data-value='0' data-action='{:url("$classuri/forbid")}' class="layui-btn layui-btn-primary layui-btn-small">审核</button>
                        {elseif b_auth("$classuri/resume")}
                        <button type="button" data-update="{$vo.id}" data-field='is_check' data-value='1' data-action='{:url("$classuri/resume")}' class="layui-btn layui-btn-primary layui-btn-small">待审核</button>
                        {/if}-->

                        {if b_auth("$classuri/edit")}
                        <button type="button" data-open='{:url("$classuri/edit")}?id={$vo.id}' class="layui-btn layui-btn-primary layui-btn-small"><i class="layui-icon"></i></button>
                        {/if}

                        {if b_auth("$classuri/del")}
                        <button type="button" data-update="{$vo.id}" data-field='is_deleted' data-value='1' data-action='{:url("$classuri/del")}' class="layui-btn layui-btn-primary layui-btn-small"><i class="layui-icon"></i></button>
                        {/if]
                    </div>

                </td>
            </tr>
{/foreach}
            </tbody>
        </table>
    </div>
    {if isset($page)}<p>{$page}</p>{/if}
</form>

<script>window.form.render();</script>
<script>
    layui.use('form', function(){
        var $ = layui.jquery, form = layui.form;

        //全选
        form.on('checkbox(allChoose)', function(data){
            var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
            child.each(function(index, item){
                item.checked = data.elem.checked;
            });
            form.render('checkbox');
        });

    });
</script>
{/block}